// store/index.js
import { createStore } from 'vuex';

export default createStore({
  state: {
    // 控制注册组件的显示与隐藏
    isRegisterVisible: false,
    // 控制登录组件的显示与隐藏
    isLoginVisible:true
  },
  mutations: {
    ShowRegistration(state, isVisible) {
      state.isRegisterVisible = isVisible;
    },
    ShowLogin(state, isVisible) {
      state.isLoginVisible = isVisible;
    }
  },
  actions: {
    ShowRegistration({ commit }, isVisible) {
      commit('ShowRegistration', isVisible);
    },
    ShowLogin({commit}, isVisible) {
      commit('ShowLogin', isVisible);
    }
  },
  getters: {
    isRegisterVisible: state => state.isRegisterVisible,
    isLoginVisible: state => state.isLoginVisible
  }
});